﻿@using PESWebMVC.Resources
@model ICollection<AuthenticationClientData>

@if (Model.Count == 0)
{
    <div class="message-info">
        <p>There are no external authentication services configured. See <a href="http://go.microsoft.com/fwlink/?LinkId=252166">this article</a>
        for details on setting up this ASP.NET application to support logging in via external services.</p>
    </div>
}
else
{
    using (Html.BeginForm("ExternalLogin", "Account", new {ReturnUrl = ViewBag.ReturnUrl}))
    {
        @Html.AntiForgeryToken()
        <fieldset id="socialLoginList">
            <legend>@RscLabels.ExternalLoginLabel</legend>
            <p>
                @foreach (AuthenticationClientData p in Model)
                {
                    var titleText = string.Format(RscLabels.ExternalProviderTitle, p.DisplayName);
                    var btnCssClass = "btn btn-large ";
                    if (p.DisplayName.ToLowerInvariant().Contains("google"))
                    {
                        btnCssClass += "btn-danger";
                    }
                    else
                    {
                        btnCssClass += "btn-primary";
                    }
                    <button type="submit" class="@btnCssClass" name="provider" value="@p.AuthenticationClient.ProviderName" title="@titleText">@p.DisplayName</button>
                }
            </p>
        </fieldset>
    }
}
